{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [],
   "source": [
    "gen_data_0=np.load('gen_data_0.npy',allow_pickle=True)\n",
    "gen_data_1=np.load('gen_data_1.npy',allow_pickle=True)\n",
    "gen_data_2=np.load('gen_data_2.npy',allow_pickle=True)\n",
    "gen_data_3=np.load('gen_data_3.npy',allow_pickle=True)\n",
    "gen_data_4=np.load('gen_data_4.npy',allow_pickle=True)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [],
   "source": [
    "import torch"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "outputs": [
    {
     "data": {
      "text/plain": "tensor([[[0.7370, 0.2652, 0.0688, 0.0029, 0.1937, 0.3734],\n         [0.2050, 0.8226, 0.2095, 0.9713, 0.5143, 0.2457],\n         [0.5553, 0.8466, 0.3782, 0.2421, 0.5153, 0.4675],\n         ...,\n         [0.1368, 0.5438, 0.9452, 0.1998, 0.9019, 0.8635],\n         [0.6125, 0.1589, 0.9578, 0.5550, 0.1804, 0.1047],\n         [0.8844, 0.3362, 0.5210, 0.7453, 0.5106, 0.4607]],\n\n        [[0.2672, 0.9679, 0.3774, 0.9643, 0.0109, 0.4482],\n         [0.8879, 0.1073, 0.9639, 0.1243, 0.1456, 0.7908],\n         [0.5809, 0.8548, 0.2650, 0.0784, 0.6895, 0.8414],\n         ...,\n         [0.5310, 0.8717, 0.4710, 0.9961, 0.1471, 0.8401],\n         [0.0309, 0.6050, 0.5915, 0.0590, 0.1490, 0.3585],\n         [0.0070, 0.6426, 0.5622, 0.2502, 0.4372, 0.5239]],\n\n        [[0.9236, 0.1306, 0.7422, 0.6189, 0.3382, 0.7197],\n         [0.5899, 0.8573, 0.5059, 0.3402, 0.2008, 0.7560],\n         [0.8384, 0.8265, 0.6576, 0.1159, 0.0609, 0.9151],\n         ...,\n         [0.4227, 0.1338, 0.1680, 0.9546, 0.0113, 0.5148],\n         [0.3094, 0.1322, 0.9445, 0.0684, 0.9322, 0.1421],\n         [0.1935, 0.0907, 0.4782, 0.3070, 0.9131, 0.3329]],\n\n        ...,\n\n        [[0.9517, 0.2639, 0.4375, 0.8865, 0.4043, 0.2956],\n         [0.6968, 0.6530, 0.4107, 0.4434, 0.5374, 0.1029],\n         [0.9129, 0.2050, 0.6927, 0.9748, 0.6376, 0.5314],\n         ...,\n         [0.7409, 0.3544, 0.2676, 0.1175, 0.7635, 0.8473],\n         [0.9531, 0.7578, 0.1912, 0.6762, 0.1077, 0.2878],\n         [0.7680, 0.6171, 0.1531, 0.0335, 0.2663, 0.6260]],\n\n        [[0.3504, 0.8706, 0.0652, 0.5267, 0.5615, 0.4617],\n         [0.1276, 0.6569, 0.2347, 0.3161, 0.1270, 0.0966],\n         [0.6504, 0.7800, 0.4900, 0.6614, 0.4293, 0.9988],\n         ...,\n         [0.0640, 0.0521, 0.7586, 0.6453, 0.8072, 0.2837],\n         [0.4170, 0.4398, 0.4243, 0.6171, 0.4058, 0.3541],\n         [0.4128, 0.2235, 0.3273, 0.3880, 0.1974, 0.9927]],\n\n        [[0.3387, 0.4847, 0.6154, 0.0685, 0.1968, 0.7818],\n         [0.0287, 0.4796, 0.6939, 0.6119, 0.5897, 0.8813],\n         [0.7573, 0.3353, 0.1185, 0.4567, 0.4943, 0.8559],\n         ...,\n         [0.3139, 0.4247, 0.8783, 0.3715, 0.9067, 0.4197],\n         [0.1428, 0.9494, 0.1612, 0.3799, 0.8710, 0.0755],\n         [0.3869, 0.6215, 0.8709, 0.2742, 0.7818, 0.1917]]])"
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "torch.FloatTensor(torch.tensor(gen_data_0).size()).uniform_()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "outputs": [],
   "source": [
    "gen_data=np.load('/home/b8313/coding/music/melody-generator-gan/src/save_/22_01_23/22_01_23_03_13_40/epoch50_gen_data_5.npy',allow_pickle=True)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [],
   "source": [
    "raw_data=np.load('/home/b8313/coding/music/melody-generator-gan/data/raw/syllable_level_npy_39/0a1c541bc1005aea8440ad9f68511bd8.npy',allow_pickle=True)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [],
   "source": [
    "raw_data=raw_data[0][1]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "outputs": [],
   "source": [
    "ngrams = zip(*[raw_data[i:] for i in range(3)])"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "outputs": [],
   "source": [
    "nlist=[ngram for ngram in ngrams]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [],
   "source": [
    "vocab=set()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "outputs": [],
   "source": [
    "vocab=vocab.union(raw_data)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "outputs": [],
   "source": [
    "word_to_ix = {word: i for i, word in enumerate(vocab)}"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "outputs": [],
   "source": [
    "ngrams = []"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "outputs": [],
   "source": [
    "ngrams.extend(nlist)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "outputs": [],
   "source": [
    "idx_ngrams_ = [[word_to_ix[w] for w in ngram] for ngram in ngrams]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "outputs": [],
   "source": [
    "idx_ngrams = [[ngram[:-1], ngram[-1]] for ngram in idx_ngrams_]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "### 3-1"
   ],
   "metadata": {
    "collapsed": false
   }
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "outputs": [],
   "source": [
    "def stat_pitch_sum(tuplt_list,init_list:list=None):\n",
    "    this_pitch_list=tuplt_list\n",
    "    pitch_list_sum=None\n",
    "\n",
    "    if init_list == None:\n",
    "        pitch_list_sum=list()\n",
    "        for i in range(100):\n",
    "            pitch_list_sum.append(0)\n",
    "    # init\n",
    "\n",
    "    else:\n",
    "        pitch_list_sum=init_list\n",
    "\n",
    "    for p in this_pitch_list:\n",
    "        pitch_list_sum[int(p)]+=1\n",
    "\n",
    "    return pitch_list_sum\n",
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "def draw_pitch_pic(pitch_sum:list,begin=0,end=100):\n",
    "    plt.bar(range(begin,end),pitch_sum[begin:end])\n",
    "    plt.ylabel('times')\n",
    "    plt.xlabel('pitch')\n",
    "    plt.title(\"True Data\")\n",
    "    plt.show()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "outputs": [],
   "source": [
    "raw_data=np.load('/home/b8313/coding/music/melody-generator-gan/data/raw/syllable_level_npy_39/0af77f9ec0279bbde8327b5134c8e37d.npy',allow_pickle=True)\n",
    "raw_data=raw_data[0][1]\n",
    "r_list=[t[0]for t in raw_data]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "outputs": [],
   "source": [
    "sum_list=stat_pitch_sum(r_list)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "outputs": [],
   "source": [
    "sum_list=stat_pitch_sum(r_list,init_list=sum_list)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "'str' object is not callable",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mTypeError\u001B[0m                                 Traceback (most recent call last)",
      "\u001B[0;32m/tmp/ipykernel_1691684/2075804001.py\u001B[0m in \u001B[0;36m<module>\u001B[0;34m\u001B[0m\n\u001B[1;32m      2\u001B[0m \u001B[0mend\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;36m100\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m      3\u001B[0m \u001B[0mplt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mbar\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mrange\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mbegin\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0mend\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0msum_list\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mbegin\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0mend\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m----> 4\u001B[0;31m \u001B[0mplt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mylabel\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m'times'\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m      5\u001B[0m \u001B[0mplt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mxlabel\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m'pitch'\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m      6\u001B[0m \u001B[0mplt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mtitle\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m\"True Data\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n",
      "\u001B[0;31mTypeError\u001B[0m: 'str' object is not callable"
     ]
    },
    {
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYA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/6eAE+CNxbVS8HrqQ3/okdd5LLgL8BZqrqVfQufLiJyRvzx4DrV/X1HWP3d/sm4Pe6ff6xy7qhNRHg7JDb9qvqbFV9tVt/kt5f6svojXW+22weOLQtBY5BksuBG4DbVnRP7HgBkrwQeB3wYYCq+llVPc6Ej5veVW/PS3Ix8Hx6941M1Jir6ovAj1Z1rzXGg8Anq+qnVfUd4Jv0sm5orQT4ZcD3VrTPdH0TK8k0cDVwH7C3qs5CL+SBPdtY2qh9AHgP8MsVfZM8XoCXAcvAR7upo9uSXMIEj7uq/hv4e+BR4Czwv1X1WSZ4zCusNcZN51orAT7UbfuTIskLgE8B76qqJ7a7nnFJ8mZgqaru3+5attjFwKuBD1XV1cCPaX/q4Bl1874HgZcCvwNckuRt21vVttt0rrUS4Dvmtv0kz6IX3p+oqru67nNJ9nWf7wOWtqu+EbsWeEuS0/SmxV6f5ONM7njPOwOcqar7uvad9AJ9ksf9BuA7VbVcVT8H7gL+kMke83lrjXHTudZKgO+I2/aThN686Mmqev+Kj44Ds936LHBsq2sbh6q6taour6ppej/Tz1XV25jQ8Z5XVT8Avpfkiq7rAPANJnvcjwLXJHl+9+f8AL3f8UzymM9ba4zHgZuSPCfJS4H9wJfX9Z2rqokv4E3AfwHfAt673fWMaYx/RO+/UF8HHui+3gS8mN5vr091y93bXesYxv7HwN3d+k4Y71XAYvez/jdg16SPG3gf8DDwIPBPwHMmbczA7fTm+H9O7wz75mcaI/DeLtMeAd643uN5K70kNaqVKRRJ0ioGuCQ1ygCXpEYZ4JLUKANckhplgEtSowxwSWrU/wN92cjbsKrsrAAAAABJRU5ErkJggg==\n"
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "begin=0\n",
    "end=100\n",
    "plt.bar(range(begin,end),sum_list[begin:end])\n",
    "plt.ylabel('times')\n",
    "plt.xlabel('pitch')\n",
    "plt.title(\"True Data\")\n",
    "plt.show()"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "'str' object is not callable",
     "output_type": "error",
     "traceback": [
      "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
      "\u001B[0;31mTypeError\u001B[0m                                 Traceback (most recent call last)",
      "\u001B[0;32m/tmp/ipykernel_1691684/1424989535.py\u001B[0m in \u001B[0;36m<module>\u001B[0;34m\u001B[0m\n\u001B[0;32m----> 1\u001B[0;31m \u001B[0mdraw_pitch_pic\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0msum_list\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0mbegin\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;36m35\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0mend\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;36m50\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m",
      "\u001B[0;32m/tmp/ipykernel_1691684/3774542611.py\u001B[0m in \u001B[0;36mdraw_pitch_pic\u001B[0;34m(pitch_sum, begin, end)\u001B[0m\n\u001B[1;32m      2\u001B[0m \u001B[0;32mdef\u001B[0m \u001B[0mdraw_pitch_pic\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mpitch_sum\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0mlist\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0mbegin\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;36m0\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0mend\u001B[0m\u001B[0;34m=\u001B[0m\u001B[0;36m100\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m      3\u001B[0m     \u001B[0mplt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mbar\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mrange\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mbegin\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0mend\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m,\u001B[0m\u001B[0mpitch_sum\u001B[0m\u001B[0;34m[\u001B[0m\u001B[0mbegin\u001B[0m\u001B[0;34m:\u001B[0m\u001B[0mend\u001B[0m\u001B[0;34m]\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0;32m----> 4\u001B[0;31m     \u001B[0mplt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mylabel\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m'times'\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[0m\u001B[1;32m      5\u001B[0m     \u001B[0mplt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mxlabel\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m'pitch'\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n\u001B[1;32m      6\u001B[0m     \u001B[0mplt\u001B[0m\u001B[0;34m.\u001B[0m\u001B[0mtitle\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0;34m\"True Data\"\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n",
      "\u001B[0;31mTypeError\u001B[0m: 'str' object is not callable"
     ]
    },
    {
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8rg+JYAAA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9T8YJGzfnrX4dJ3HcPL+q9q947/nA42bkhV7Lvt4tPr77Ov+b2D8BXs8aFyRtpYtkfAVwtKq+2W23OKaIF8tYwNO69T/AmK8FSHIFcCPwthWrDwFz3fwccHiLY32PtTJW1fur6tFu8UMsX1cxVuu8ljAh4wbWzTgx4wbWzThR42YdA4+bLTmH3v24cx+wCJysqnuSvBj4j6r6+FZk6GWtjMDTgZ9Lck+Sf0ry0xOY8RbgLUm+wPKR0LiPLG9luWy+s2Ld7qo6C9BNd40h10q3cmHGlX4N+LstS7O+W1mVc9LGDWu/lhM1blg74y1M1rgp4P1J7u1ulwIbGDdbUuhV9e3uR5srgGuTPAt4I8s/6kyENTI+k+X36e8ArgN+CzieZK1bHowz4yuA11bVlcBrgbePK1+SFwGLVXXvuDL00itjkjcCjwLv3NJgF+a4IGeSJzNB4+Yir+XEjJuLZJyYcdO5vqqew/Lda1+Z5Lkb+i5VtaVfwO8Bv8PyUeaZ7utRls8H/tBW57lIxtcBdwPPW7H+s8DUuPOtyvjffPd6ggBfHWOmP2T5lhBngC8B3wDewfIN2fZ02+wBHpy0jN1jM8AHgSdPwN/vWjnfO0nj5iJ/3xMzbi6ScWLGzRqZf78b2wOPm60INwVc1s0/CfgX4EWrtjkDXD7GF3DNjMDLgT/o1j8d+ML5fwQTlPHU+cEDHADuHdfruCrv84A7u/m3ALPd/Czw5nHnWyPjQeDT4yqefnOuWj/WcXOR13Jixs1FMk7MuAGeAjx1xfy/df8eBx43W/Eh0XuAuSx/IMbjgONVdWePfbbamhmzfI+a25J8CvgWMFPdqztBGb8CvDXJpcD/8t1bFU+Soyz/2H0zy0eUN405z1r+FPg+4GR3duBDVfXy8Ubatm5jcsbNen6DyRk3u4Hbu393lwLvqqq7k3yEAceNl/5LUiO8UlSSGmGhS1IjLHRJaoSFLkmNsNAlqREWuiQ1wkKXpEb8H6wylwUWlaFZAAAAAElFTkSuQmCC\n"
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "draw_pitch_pic(sum_list,begin=35,end=50)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "d=np.load('/home/b8313/coding/music/melody-generator-gan/data/raw/word_level_29/0a1c541bc1005aea8440ad9f68511bd8.npy',allow_pickle=True)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "outputs": [],
   "source": [
    "lyrics = d[0][2]"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}